home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-07-24 | 4.4 KB | 101 lines | [TEXT/CWIE] |
- // --------------------------------------------------------------------------------------------
- // UGetMulltipleFiles - An Add Files utility class
- // By David Hirsch
- // --------------------------------------------------------------------------------------------
-
- #pragma once
- #include "LFSSpecArrayComp.h"
-
- // --------------------------------------------------------------------------------------------
- // Items in the custom dialog box.
- // --------------------------------------------------------------------------------------------
- const ResIDT kDLOG_OpenMultiple = 900;
- const ResIDT kStdButton_Add = 1;
- const ResIDT kDesktopButton = 6;
- const ResIDT kUserItem_FileList = 7;
- const ResIDT kStaticText_Prompt = 10;
- const ResIDT kUserItem_AddedList = 11;
- const ResIDT kStdButton_Done = 12;
- const ResIDT kStdButton_Remove = 13;
- const ResIDT kStdButton_AddAll = 15;
- const ResIDT kPict_DividerLine = 14;
- const ResIDT kStdButton_RemoveAll = 16;
- const ResIDT kStdButton_Select = 17;
- const short kHome = 1;
- const short kEnd = 4;
- const short kUpArrow = 30;
- const short kDownArrow = 31;
- const short kPageUp = 11;
- const short kPageDown = 12;
- const short kUpArrowPlusCO = kUpArrow + sfHookCharOffset;
- const short kDownArrowPlusCO = kDownArrow + sfHookCharOffset;
-
- const ResIDT kSTR_List = 900;
- const ResIDT kSTR_SelectItem = 1;
- const Str255 kFolderButtonRoot = "\pAdd \"";
-
- const short kMaxNumFilesToFind = 20; // number of files to examine at a time
- const short kNumAddedCellsVisible = 5; // number of cells that are visible in the added
- // file list at once
-
-
- struct dataHolderType {
- short whichFocused;
- };
-
- class UGetMultipleFiles {
- public:
- enum { err_otherGetDirErr = 'oGDE' };
- UGetMultipleFiles();
- UGetMultipleFiles(Str255 prompt, short numTypes = 0, SFTypeList typeList = nil,
- LArray *inFileList = nil, Boolean inAllowConversion = true,
- Boolean inShowFolders = true, Boolean inAddFolders = false);
- ~UGetMultipleFiles();
- static LArray *GetFSSpecs();
- static StandardFileReply GetSFReply();
- private: // member functions
- static pascal Boolean myModalFilter (DialogPtr theDialogP, EventRecord *event,
- short *itemHit, void *myUnused);
- static pascal short myDialogHook (short item, DialogPtr theDialogP, void *myUnused);
- static pascal Boolean myFileFilter (CInfoPBPtr pb, void *ioParam);
- static pascal void myActivateProc (DialogPtr theDialogP, short itemNum,
- Boolean activating, void *ioParam);
- static pascal void MyDrawListItem (WindowPtr theWindow, short item);
- static void AddOneToList(Str255 , long , short);
- static void AddAllToList(Boolean atDesktop);
- static void RemoveAllFromList();
- static void RemoveFromList();
- static long GetSFCurDir(void);
- static short GetSFVRefNum(void);
- static ListHandle MyCreateTextListInDialog (DialogPtr , short );
- static ListHandle MyCreateVerticallyScrollingList (WindowPtr , Rect , short , short );
- static void SetEnable(ResIDT theItem, Boolean enabled);
- static Boolean GetEnabled(ResIDT theItem);
- static void ReplaceString ( Str255 destStr, Str255 whatStr, Str255 byStr );
- static Boolean TypeInList( OSType inType );
- static void SetCurrentVolume(short vRefNum);
- static void SetCurrentDirectory(long dirID);
- static void FixButtons (DialogPtr theDialogP, void *ioParam);
- static void SetButtonTitle (Handle ButtonHdl, Str255 name, Rect ButtonRect);
- static void DoListKey(short theKey, ListHandle theListH);
- static Boolean IsFile(FSSpec inFile);
- static OSErr GetCatInfoNoName(short vRefNum, long dirID, ConstStr255Param name, CInfoPBPtr pb);
- static void EnsureSelection(short inActiveList);
- static inline Boolean IsFolder(CInfoPBPtr pb) {return (pb->hFileInfo.ioFlAttrib & 0x10);};
-
- private: // data members
- static ListHandle sAddedListH;
- static DialogPtr sDialogP;
- static StandardFileReply sReply;
- static LArray *sTheFSpecs;
- static LArray *sNixFiles;
- static LFSSpecArrayComp *sComparatorP;
- static short sNumTypes;
- static SFTypeList sTypeList;
- static Boolean sNeedToRebuild;
- static Boolean sShowFolders;
- static Boolean sAddFolders;
- static Boolean sAllowConversion; // Allow MEO to convert the File,
- // allow checking for locked files, etc.
- static short sKeyPressed;
- };